/**
 * @param {number[]} nums
 * @param {number[]} queries
 * @return {number[]}
 */
nums=[2,3,4,5]
queries=[1]
var answerQueries = function(nums, queries) {
    nums.sort((a,b)=> a-b)
    let ans =[]
    for(let i=0;i<queries.length;i++){
        let sum =0,count=0;
        for(let j =0;j<nums.length;j++){
            sum+=nums[j]
            if(sum<=queries[i]){
                count++
            }
            else{
                break
            }
        }
        ans.push(count)
    }
    return ans
};
console.log(answerQueries(nums,queries))
